<?php

/*
	[SupeSite] (C) 2007-2009 Comsenz Inc.
	$Id: admin_index.php 8955 2008-10-15 09:39:05Z zhaolei $
*/

if(!defined('IN_SUPESITE')) {
	exit('Access Denied');
}

//成交
if($_GET['req'] == 'deal'){
        if(!empty($_POST['uid'])){
            $modelClass = 'app\com\simtoon\models\UserHouse';
            $data = YiiComm::executeByMethod($modelClass,'getDealHouse',$_POST);
            $pagin = $data->getPagination();

            $pagin = objectToArray($pagin);
            $delResult = $data->getModels();

            $delJson = array();
            foreach($delResult as $val){
                $arr = array('domain_name'=>$val['domain_name'],'room_num'=>$val['room_num'],'hall_num'=>$val['hall_num'],'structure_area'=>$val['structure_area'],'house_driect'=>$val['house_driect'],'house_tene_type'=>$val['house_tene_type'],'floor_count'=>$val['floor_count'],'build_year'=>$val['build_year'],'cons_structure'=>$val['cons_structure'],'contract_type'=>$val['contract_type'],'total'=>$val['contract_price'],'area_name'=>$val['area_name'],'house_no'=>$val['house_no'],'house_floor'=>$val['house_floor'],'thumb'=>$val['thumb']);
                $delJson[] = $arr;
            }
            $delJson[] = $pagin;
            $delResult =json_encode($delJson);
            die($delResult);
        }
}

//推荐
if($_GET['req'] == 'recomm'){
    if(!empty($_POST['uid'])){
        $modelClass = 'app\com\simtoon\models\UserHouse';
        $data = YiiComm::executeByMethod($modelClass,'getRecommHouse',$_POST);
        $pagin = $data->getPagination();

        $pagin = objectToArray($pagin);
        $delResult = $data->getModels();

        $delJson = array();
        foreach($delResult as $val){
            $arr = array('domain_name'=>$val['domain_name'],'room_num'=>$val['room_num'],'hall_num'=>$val['hall_num'],'structure_area'=>$val['structure_area'],'house_driect'=>$val['house_driect'],'floor_count'=>$val['floor_count'],'build_year'=>$val['build_year'],'sale_single'=>$val['sale_single'],'total'=>$val['total'],'area_name'=>$val['area_name'],'house_no'=>$val['house_no'],'house_floor'=>$val['house_floor'],'trade_type'=>$val['trade_type'],'floor_count'=>$val['floor_count'],'rent_listing'=>$val['rent_listing'],'tene_application'=>$val['tene_application'],'title'=>$val['title'],'thumb'=>$val['thumb'],'url'=>$val['url']);
            $delJson[] = $arr;
        }
        $delJson[] = $pagin;
        $recommResult =json_encode($delJson);
        die($recommResult);
    }
}

//新上
if(!empty($_SGLOBAL['user']['uid'])){
    $uid = array('uid'=>$_SGLOBAL['user']['uid'],'pg'=>$_GET['pg']);

    $modelClass = 'app\com\simtoon\models\UserHouse';
    $data = YiiComm::findDataByPagination($modelClass, $uid);
    $pagin = $data->getPagination();

    $pagin = objectToArray($pagin);
    $newResult = $data->getModels();




}

include template('cp_uindex');

?>